Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve diagnostics for lifetime after &mut #73595

Merged
merged 1 commit into from
Sep 15, 2020

Conversation

SNCPlay42
Copy link
Contributor

If, when parsing a borrow pointee type, we see a lifetime after mut, suggest placing the lifetime before mut and eat the lifetime to avoid a large number of unhelpful diagnostics.

There are some subtleties to avoid false positives in cases like &mut 'a + Trait, where &mut ('a + Trait) is a better suggestion.

fixes #73568

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @matthewjasper (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 21, 2020
@LeSeulArtichaut
Copy link
Contributor

r? @estebank

@SNCPlay42
Copy link
Contributor Author

SNCPlay42 commented Jun 22, 2020

Should I squash that commit?

EDIT: ouch, whitespace. :(

@SNCPlay42 SNCPlay42 force-pushed the lifetime-after-mut branch from d7006a4 to 772058c Compare June 22, 2020 10:28
@Muirrum
Copy link
Member

Muirrum commented Jul 24, 2020

@SNCPlay42 @ayazhafiz This is a triage bump.

@ayazhafiz
Copy link
Contributor

@Muirrum should this be labeled/tagged for higher visibility? re the issue this commit fixes is a p-high

@crlf0710 crlf0710 added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 7, 2020
@SNCPlay42
Copy link
Contributor Author

@estebank this is waiting for your review

@bors

This comment has been minimized.

@SNCPlay42 SNCPlay42 closed this Aug 31, 2020
@SNCPlay42 SNCPlay42 deleted the lifetime-after-mut branch August 31, 2020 12:14
@SNCPlay42 SNCPlay42 restored the lifetime-after-mut branch August 31, 2020 12:15
@SNCPlay42 SNCPlay42 reopened this Aug 31, 2020
@jyn514 jyn514 added A-diagnostics Area: Messages for errors, warnings, and lints A-lifetimes Area: Lifetimes / regions A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` labels Sep 15, 2020
@Dylan-DPC-zz
Copy link

r? @Mark-Simulacrum

@Mark-Simulacrum
Copy link
Member

Thank you!

I've squashed the commits here into one as well.

@bors r+

@bors
Copy link
Contributor

bors commented Sep 15, 2020

📌 Commit 4de9a53 has been approved by Mark-Simulacrum

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 15, 2020
@bors
Copy link
Contributor

bors commented Sep 15, 2020

⌛ Testing commit 4de9a53 with merge 6af1bdd...

@bors
Copy link
Contributor

bors commented Sep 15, 2020

☀️ Test successful - checks-actions, checks-azure
Approved by: Mark-Simulacrum
Pushing 6af1bdd to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 15, 2020
@bors bors merged commit 6af1bdd into rust-lang:master Sep 15, 2020
@rustbot rustbot added this to the 1.48.0 milestone Sep 15, 2020
@SNCPlay42 SNCPlay42 deleted the lifetime-after-mut branch September 23, 2020 22:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-lifetimes Area: Lifetimes / regions A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Placing lifetime specifier after &mut emits wall of unhelpful diagnostics